home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / text / tex / amiweb2c.lha / AmiWeb2c-2.1 / texmf / pastex / rexx / StartDVIprint.sd < prev    next >
Encoding:
Text File  |  1997-02-09  |  2.1 KB  |  104 lines

  1. /*
  2. ** StartDVIprint.sd
  3. **
  4. ** This is a small hack to run DVIprint from ShowDVI.
  5. **
  6. ** NOTES: You must have set the printer name in ENV:DVIprint for this to
  7. ** work, or the default (generic) printer will be used.
  8. **
  9. ** 'TeX:bin/DVIprint' is used to find DVIprint. Otherwise it would
  10. ** have to be in your RexxMast path...
  11. */
  12.  
  13. LF = '0A'X
  14.  
  15. Address COMMAND 'version >nil: exec.library 36'
  16. If RC ~= 0 Then
  17.   CONWINDOW = "CON:20/30/430/100/DVIprint--Output"
  18. Else
  19.   CONWINDOW = "CON:20/30/430/100/DVIprint--Output/AUTO/CLOSE/WAIT/SCREENShowDVI-PubScr"
  20.  
  21. Options Results
  22.  
  23. GetFile
  24. LOADEDFILE = RESULT
  25.  
  26. GetDir
  27. LOADEDDIR = RESULT
  28.  
  29. GetPage
  30. PAGE = RESULT
  31.  
  32. If Right(LOADEDDIR,1)~='/' & Right(LOADEDDIR,1)~=':' Then
  33.   LOADEDDIR = LOADEDDIR||'/'
  34.  
  35. If Upper(Right(LOADEDFILE,4)) ~= ".DVI" Then
  36.   LOADEDFILE = LOADEDFILE||".dvi"
  37.  
  38. If LOADEDFILE = "" | ~Exists(LOADEDDIR||LOADEDFILE) Then Do
  39.   Message "Which file should I print?"
  40.   Exit
  41. End
  42.  
  43. If Show('Port','dviprint') Then Do
  44.    Message "DVIprint is already running, please wait"
  45.    Exit
  46. End
  47.  
  48. /*
  49. ** HES: It would be nice to know how many pages the document has...
  50. */
  51.  
  52. Okay2 "Print all pages with the predefined draft-modus?"
  53. If RESULT ~= 1 Then Do
  54.   GetNumber PAGE "Print from page?"
  55.   If 0 = RC Then
  56.     FROM = RESULT
  57.   Else Do
  58.     Message "Print cancelled!"
  59.     Exit 0
  60.   End
  61.  
  62.   GetNumber PAGE "Print upto page?"
  63.   If 0 = RC Then
  64.     TO = RESULT
  65.   Else Do 
  66.     Message "Print cancelled!"
  67.     Exit 0
  68.   End
  69.  
  70.   Okay2 "Should I print in draft mode?"
  71.   If RESULT = 1 Then
  72.     DRAFT = "on"
  73.   Else
  74.     DRAFT = "off"
  75.  
  76.   STR = "Should I start the print"||LF||" of file '"LOADEDFILE"'"LF||" from page "FROM" to page "TO||LF
  77.  
  78.   If DRAFT = "on" Then
  79.     STR = STR||" in draft mode?"
  80.   Else
  81.     STR = STR||" in HQ mode?"
  82.  
  83.   Okay2 STR
  84.   If RESULT = 0 Then Do
  85.     Message "Print cancelled!"
  86.     Exit 0
  87.   End
  88.  
  89.   Message "calling DVIprint."
  90.  
  91.   Address COMMAND 'TeX:bin/DVIprint' ">"CONWINDOW" from "FROM" to "TO" draft "DRAFT LOADEDDIR||LOADEDFILE
  92.   If 0 ~= RC Then
  93.     Message "DVIprint failed."
  94.  
  95. End; Else Do
  96.   Message "calling DVIprint."
  97.  
  98.   Address COMMAND 'TeX:bin/DVIprint' ">"CONWINDOW " " LOADEDDIR||LOADEDFILE
  99.   If 0 ~= RC Then
  100.     Message "DVIprint failed."
  101. End
  102.  
  103. Exit
  104.